import requests
from hashlib import new

host = 'http://127.0.0.1:8000/'

def signin(id, password):
    psw = str(new('md5', password.encode()).hexdigest())
    data = {'command': 'signin', 'id': id, 'password': psw}
    res = requests.post(host, data)
    return res.json()

def signup(name, password):
    psw = str(new('md5', password.encode()).hexdigest())
    data = {'command': 'signup', 'username': name, 'password': psw}
    res = requests.post(host, data)
    return res.json()